home *** CD-ROM | disk | FTP | other *** search
/ Cream of the Crop 11 / Cream of the Crop 11-2.iso / os2 / fm2utl.zip / makeobj.cmd < prev    next >
OS/2 REXX Batch file  |  1995-03-27  |  1KB  |  52 lines

  1. /* Makes a WPS object out of the filename it receives as an argument. */
  2.  
  3. isprg = 0
  4. isicon = 0
  5. isptr = 0
  6. isbmp = 0
  7. setup = ''
  8. parse arg filename
  9. filename = strip(filename)
  10. if filename \= '' then
  11. do
  12.   call RxFuncAdd 'SysLoadFuncs', 'RexxUtil', 'SysLoadFuncs'
  13.   call SysLoadFuncs
  14.   rc = stream(filename,'c','query exists')
  15.   if rc \= '' then
  16.   do
  17.     ext = right(rc,length(rc) - lastpos(".",rc))
  18.     parse upper var ext ext
  19.     if ext = 'EXE' then isprg = 1
  20.     else if ext = 'COM' then isprg = 1
  21.     else if ext = 'CMD' then isprg = 1
  22.     else if ext = 'BAT' then isprg = 1
  23.     else if ext = 'ICO' then isicon = 1
  24.     else if ext = 'PTR' then isptr = 1
  25.     else if ext = 'BMP' then isbmp = 1
  26.     if isprg \= 0 then
  27.     do
  28.       /* create program objects for programs */
  29.       setup = 'EXENAME='rc';PARAMETERS=%*'
  30.       type = 'WPProgram'
  31.     end
  32.     else
  33.     do
  34.       /* create shadows for everything else */
  35.       type = 'WPShadow'
  36.       setup = 'SHADOWID='rc
  37.     end
  38.     title = right(rc,length(rc) - lastpos("\",rc))
  39.     temp = left(title,lastpos(".",title) - 1)
  40.     if temp \= '' then title = temp
  41.     call SysCreateObject type,title,'<WP_DESKTOP>',setup,f
  42.   end
  43.   else
  44.     say "Can't find "filename"."
  45. end
  46. else
  47. do
  48.   say 'Usage:  MAKEOBJ filename'
  49.   say ' Creates a WPS object on the desktop for the filename.'
  50.   say ' Excellent for drag and drop use.'
  51. end
  52.